function getUser () {
	return createAsyncAction('APP_GET_USER', () => {
		api.get('/api/me')
	})
}

function getAnswers (user) {
	return createAsyncAction('APP_GET_ANSWERS', () => {
		api.get(`/api/answers/${user.id}`)
	})
}

function getUserAnswers () {
	const handlers = [{
		status: 'success',
		callback: getAnswers,
	}, {
		status: 'error',
		callback: payload => (() => {
			console.log(payload)
		})
	}

	return createChainedAsyncAction(getUser(), handlers)
}

export default {
	getUser,
	getAnswers,
	getUserAnswers
}